#pragma once

#include <QJsonObject>
#include <QPluginLoader>
#include <QQuickItem>

class SbotPlugin : public QObject {
public:
    QPluginLoader* pluginLoader = nullptr;
    QQuickItem*    uiItem       = nullptr;
    QString        pluginFilePath;
    QJsonObject    pluginInfo;

public:
    explicit SbotPlugin(QObject* parent = nullptr) : QObject(parent) {}
    virtual ~SbotPlugin() = default;
    QString pluginLogo()
    {
        return m_pluginLogo;
    }
    QString pluginQml()
    {
        return m_pluginQml;
    }
    virtual void open()     = 0;
    virtual void close()    = 0;
    virtual bool isOpened() = 0;

protected:
    QString m_pluginLogo = "qrc:Icon/Plugin.png";
    QString m_pluginQml  = "qrc:Qml/Plugin.qml";
};

QT_BEGIN_NAMESPACE
#define SbotPlugin_iid "org.SBOT.SbotPluginInterface"
Q_DECLARE_INTERFACE(SbotPlugin, SbotPlugin_iid)
QT_END_NAMESPACE
